import {listenKeydown} from "./func/globalEvtFunc";

import { App } from "./page/App/App";
import { createElement } from "react";
import { render } from "react-dom";
import "antd/dist/antd.css";
import "./scss/base.scss";
import {installTables} from "./func/dbFunc";
import {getAppObj} from "../common/function/appFunc";
import { remote } from "electron";

declare global {
    interface Window {
        electronApp: Electron.App;
        electronRemote: Electron.Remote;
    }
}

window.electronApp = getAppObj();
window.electronRemote = remote;

installTables()
    .then(() => {
        console.log("install tables okay");
        render(createElement(App), document.getElementById("app"));
        listenKeydown();
    })
    .catch((err) => {
        console.error("install tables error:");
        console.error(err);
    });
